<script setup>
const res=defineProps({
  dynamic: {
    required: true,
    type: Object
  }
})
console.log(res.dynamic)
</script>

<template>
<div class="article-page" >
    <div 
      class="article-item"
      >
      <div class="head" @click="$router.push(`/dynamicDetail/${dynamic.dynamicId}`)">
        <div v-if="dynamic.avatar">
      <img width="38px" v-if="dynamic.avatar!='default.jpg'" :src="dynamic.avatar">
              <img v-else width="38px" src="@/assets/boy.jpg" />
            </div>

        <div class="con">
          <p class="title">{{dynamic.title}}</p>
          <p class="other">{{ dynamic.userName }} {{ dynamic.userName ? '|':'' }} {{ dynamic.publishTime }}</p>
        </div>
      </div>
      <div class="body">
          <span class="con_text"  v-html="dynamic.content" ></span>
      </div>
      <div class="foot">点赞 {{ dynamic.likeNum }}
        <div style="text-align: right;"><slot name="eidt_delete"></slot></div>
      </div>
    </div>
    
  </div>
</template>

<style scoped>
.article-page {
  background: #f5f5f5;
  width: 100%;
  margin-top: 15px;
}
.article-item {
  margin-bottom: 10px;
  background: #fff;
  padding: 10px 15px;
  .head {
    display: flex;
    img {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      overflow: hidden;
    }
    .con {
      flex: 1;
      overflow: hidden;
      padding-left: 15px;
      p {
        margin: 0;
        line-height: 1.5;
        &.title {
          text-overflow: ellipsis;
          overflow: hidden;
          width: 100%;
          
          white-space: nowrap;
        }
        &.other {
          font-size: 10px;
          color: #999;
        }
      }
    }
  }
  .body {
    width: 500px;
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-top: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: nowrap;
  }
  .foot {
    font-size: 12px;
    color: #999;
    margin-top: 10px;
  }
}
.con_text{
width: 100px;

white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;



}
</style>